package cn.edu.hhtc.stsystem.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.hhtc.stsystem.Exception.ServiceException;
import cn.edu.hhtc.stsystem.dao.SupplierDao;
import cn.edu.hhtc.stsystem.entity.SupplierEntity;
import cn.edu.hhtc.stsystem.entity.form.SupplierEntityForm;

@Service("supplierService")
@Transactional(rollbackFor=Exception.class)
public class SupplierServiceImpl implements SupplierService {
	
	@Autowired
	private SupplierDao supplierDao;

	@Override
	public void addSupplier(SupplierEntityForm form) throws ServiceException {
		try{
			SupplierEntity entity=new SupplierEntity(form.getSupplierName(),form.getSupplierAtten(),form.getSupplierTel(),
					form.getSupplierAdd(),form.getSupplierBank(),form.getSupplierCard(),form.getSupplierEmail());
			supplierDao.save(entity);
		} catch(Exception e){
			throw new ServiceException(e);
		}
		

	}

}
